﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 易容酒店管理系统
{
    public partial class Main_function : Form
    {
        public Main_function()
        {
            InitializeComponent();
        }

        /* picRoom_service.Enabled = false; //房屋管理
           picReception.Enabled = false; //前台
           picFinance.Enabled = false; //财务管理
           picStock.Enabled = false; //库存管理
           picBackstage.Enabled = false; //后台设置
           picSoftware_registration.Enabled = false; //软件注册
         * */

        private void Main_function_Load(object sender, EventArgs e)
        {


            switch (Method.type)
            {
                case "前台":
                     picStock.Enabled = false; //库存管理
                     picFinance.Enabled = false; //财务管理
                     picBackstage.Enabled = false; //后台设置
                     picSoftware_registration.Enabled = false; //软件注册
                    break;
                case "后勤":
                     picRoom_service.Enabled = false; //房屋管理
                     picReception.Enabled = false; //前台
                     picFinance.Enabled = false; //财务管理
                     picBackstage.Enabled = false; //后台设置
                     picSoftware_registration.Enabled = false; //软件注册
                    break;
                case "保洁":
                     picReception.Enabled = false; //前台
                     picFinance.Enabled = false; //财务管理
                     picStock.Enabled = false; //库存管理
                     picBackstage.Enabled = false; //后台设置
                     picSoftware_registration.Enabled = false; //软件注册
                    break;
                default :
                    //
                    break;
            }

        }
        #region 按钮
        //前台
        private void picReception_Click_1(object sender, EventArgs e)
        {
            Reception newReception = new Reception();       //创建新窗体对象
            newReception.TopLevel = false;                  //取消顶级桌面
            Method.frm.panel1.Controls.Clear();             //清空panel控件中所有的内容
            Method.frm.panel1.Controls.Add(newReception);   //将新窗体中的内容加载进panel控件中
            newReception.Show();                            //打开窗体
            Method.SetDouble(Method.frm.panel1);
        }
        //房务
        private void picRoom_service_Click(object sender, EventArgs e) ///一下方法如上
        {
            Room_service newRoom_service = new Room_service();
            newRoom_service.TopLevel = false;
            Method.frm.panel1.Controls.Clear();
            Method.frm.panel1.Controls.Add(newRoom_service); 
            newRoom_service.Show();
            Method.SetDouble(Method.frm.panel1);
        }
        //财务
        private void picFinance_Click(object sender, EventArgs e)
        {
            Finance newFinance = new Finance();
            newFinance.TopLevel = false;
            Method.frm.panel1.Controls.Clear();
            Method.frm.panel1.Controls.Add(newFinance);
            newFinance.Show();
            Method.SetDouble(Method.frm.panel1);
        }
        //库存
        private void picStock_Click(object sender, EventArgs e)
        {
            Stock newStock = new Stock();
            newStock.TopLevel = false;
            Method.frm.panel1.Controls.Clear();
            Method.frm.panel1.Controls.Add(newStock);
            newStock.Show();
            Method.SetDouble(Method.frm.panel1);
        }
        //后台
        private void picBackstage_Click(object sender, EventArgs e)
        {
            Backstage newBackstage = new Backstage();
            newBackstage.TopLevel = false;
            Method.frm.panel1.Controls.Clear();
            Method.frm.panel1.Controls.Add(newBackstage);
            newBackstage.Show();
            Method.SetDouble(Method.frm.panel1);
        }
        //软件注册
        private void picSoftware_registration_Click(object sender, EventArgs e)
        {
            Software_registration newSoftware_registration = new Software_registration();
            newSoftware_registration.TopLevel = false;
            Method.frm.panel1.Controls.Clear();
            Method.frm.panel1.Controls.Add(newSoftware_registration);
            newSoftware_registration.Show();
            Method.SetDouble(Method.frm.panel1);
        }
        #endregion
        #region 防止闪屏
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000;
                return cp;
            }
        }
        #endregion
    }
}
